package com.ljf.common.service;

import com.ljf.common.dto.query.PageParam;
import com.ljf.common.exception.ServiceException;
import com.ljf.common.result.ServiceResultModel;

import java.io.Serializable;
import java.util.List;

/**
 * 基础服务接口定义
 *
 * @author LJF
 * @since 2024-01-25
 */
public interface IBasisService<Q extends PageParam, V extends Serializable, A extends Serializable> extends INoDBBasisService {

    /**
     * 分页查询接口
     *
     * @param query
     * @return
     * @throws ServiceException
     */
    ServiceResultModel<V> query(Q query) throws ServiceException;

    /**
     * 查询接口
     *
     * @param query
     * @return
     * @throws ServiceException
     */
    ServiceResultModel<V> queryList(Q query) throws ServiceException;

    /**
     * 更新接口
     *
     * @param command
     * @return
     * @throws ServiceException
     */
    ServiceResultModel edit(A command) throws ServiceException;

    /**
     * 根据ID查询接口
     *
     * @param id
     * @return
     * @throws ServiceException
     */
    ServiceResultModel<V> queryById(Long id) throws ServiceException;

    /**
     * 查询接口(仅一条数据)
     *
     * @param query
     * @return
     * @throws ServiceException
     */
    ServiceResultModel<V> queryOne(Q query) throws ServiceException;

    /**
     * 查询接口(仅一条数据)
     *
     * @param query
     * @param noRecordMsg
     * @param multipleRecordMsg
     * @return
     * @throws ServiceException
     */
    ServiceResultModel<V> queryOne(Q query, String noRecordMsg, String multipleRecordMsg) throws ServiceException;

    /**
     * 新增接口
     *
     * @param command
     * @return
     * @throws ServiceException
     */
    ServiceResultModel add(A command) throws ServiceException;

    /**
     * 删除接口
     *
     * @param id
     * @return
     * @throws ServiceException
     */
    ServiceResultModel delete(Long id) throws ServiceException;

    /**
     * 批量删除接口
     *
     * @param ids
     * @return
     * @throws ServiceException
     */
    ServiceResultModel deleteBatch(List<Long> ids) throws ServiceException;

}
